package com.hahehiho.myalbum;

import java.io.IOException;


public class ThumbnailCreator {

	public static void main(String[] args) {
		System.out.println("start");
		MyAlbumDB db = MyAlbumDB.getInstance();
		System.out.println("db get");
		MyAlbumVO[] result = db.selectAllPhotoList();
		
		System.out.println("create thumbnail = "+ result.length);
		for(int i = 0; i < result.length; i++) {
			String fileName = result[i].getFilePath();
			
			
			String loadFile = fileName.replace("/media/MGTEC", "Y:");
			loadFile = loadFile.replace("/", "\\");
			
			String saveFile = loadFile.replace("Y:\\Picture", "Y:\\Picture.t");
			
			try {
				Thumbnail.createImage(loadFile, saveFile, false);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			System.out.println((((i+1)*100)/result.length) + "%");
		}
		System.out.println("end");
	}

}
